<template>
  <div class="auth-layout" :class="{ 'dark-mode': isDarkMode }">
    <div class="auth-container">
      <div class="auth-content">
        <div class="branding">
          <img src="@/assets/logo.svg" alt="Logo" class="logo" />
          <h1 class="brand-name">AI Chat</h1>
        </div>
        <router-view v-slot="{ Component }">
          <transition name="fade" mode="out-in">
            <component :is="Component" />
          </transition>
        </router-view>
      </div>
      <div class="theme-toggle" @click="toggleDarkMode">
        <Icon :icon="isDarkMode ? 'ph:sun-bold' : 'ph:moon-bold'" />
      </div>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref } from 'vue'
import { Icon } from '@iconify/vue'

const isDarkMode = ref(false)

const toggleDarkMode = () => {
  isDarkMode.value = !isDarkMode.value
  document.documentElement.classList.toggle('dark', isDarkMode.value)
}
</script>

<style lang="scss" scoped>
.auth-layout {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-gradient);
  transition: all 0.3s ease;

  &.dark-mode {
    --bg-gradient: linear-gradient(135deg, #1a1a1a 0%, #2d2d2d 100%);
    color: #ffffff;
  }
}

.auth-container {
  width: 100%;
  max-width: 460px;
  margin: 0 20px;
  position: relative;
}

.auth-content {
  background: rgba(255, 255, 255, 0.9);
  backdrop-filter: blur(10px);
  border-radius: 24px;
  padding: 40px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
  
  .dark-mode & {
    background: rgba(45, 45, 45, 0.9);
  }
}

.branding {
  text-align: center;
  margin-bottom: 40px;

  .logo {
    width: 64px;
    height: 64px;
    margin-bottom: 16px;
  }

  .brand-name {
    font-size: 28px;
    font-weight: 700;
    background: linear-gradient(135deg, #42b883, #347474);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
  }
}

.theme-toggle {
  position: fixed;
  bottom: 40px;
  right: 40px;
  width: 48px;
  height: 48px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;

  &:hover {
    transform: scale(1.1);
  }

  .dark-mode & {
    background: rgba(45, 45, 45, 0.9);
    color: #ffffff;
  }
}

.fade-enter-active,
.fade-leave-active {
  transition: opacity 0.3s ease;
}

.fade-enter-from,
.fade-leave-to {
  opacity: 0;
}
</style> 